package animation.xj.com.butterknife_complie;

import java.lang.annotation.Annotation;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
/**
 *@author:ike
 *@function: 手写ButterKnife
 *@creat time:18:07 2018/3/7
 **/
public class IkeKnifeAbstractProcessor  extends AbstractProcessor {
    /**
     * 指定版本
     * @return
     */
    @Override
    public SourceVersion getSupportedSourceVersion() {
        return SourceVersion.latestSupported();
    }

    /**
     * 获取支持的注解类型
     * @return
     */
    @Override
    public Set<String> getSupportedAnnotationTypes() {
        Set<String> set=new LinkedHashSet<>();
        for (Class<? extends Annotation> annotation:getSupportedAnnotations()){
            set.add(annotation.getCanonicalName());
        }
        return super.getSupportedAnnotationTypes();
    }

   
    /**
     * 参考了 ButterKnife 的写法
     
     * @return
     */
    private Set<Class<? extends Annotation>> getSupportedAnnotations() {
        Set<Class<? extends Annotation>> annotations = new LinkedHashSet<>();
        annotations.add(BindView.class);
        return annotations;
    }
    @Override
    public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
        
        return false;
    }
}
